package com.example.administrator.testdagger.design.factory;

import com.example.administrator.testdagger.*;
import com.example.administrator.testdagger.Product;

/**
 * com.example.administrator.testdagger.design.factory
 * (c)2018 AIR Times Inc. All rights reserved.
 *
 *
 * @author WangJQ
 * @version 1.0
 * @date 2018/6/25 16:18
 * @see com.example.administrator.testdagger.design.factory
 */
public class ConcreteFactory extends BaseFactory {
    @Override
    public <T extends Product> T createProduct(Class<T> clz) {
        Product p = null;
        try {
            p = (Product) Class.forName(clz.getName()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return (T) p;
    }
}
